<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div time="2" index="2" data-index="333" data-list-name="mingda"></div>
    <script>
        var div = document.querySelector('div');
        console.log(div.getAttribute('time'));
        div.setAttribute('info','2');
        // 自定义是属性规范data-xxx
        // 获取方法除了以上的之外
        console.log(div.dataset.index);
        // 多个名
        console.log(div.dataset.listName);
    </script>
</body>
</html>